package top.noteday.controller;

import java.util.List;
import java.util.Date;
import entity.Page;
import entity.result.EntityResult;
import org.springframework.beans.factory.annotation.Autowired;
import entity.result.PageResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.PostMapping;
import entity.field.*;
import top.noteday.impl.FieldServiceImpl;

@RestController
@RequestMapping(value = "/backstage/field")
public class FieldServiceController {

    @Autowired
    private FieldServiceImpl fieldService;

    /**
     * 查询一个
     */
    @PostMapping(value = "/selectById")
    public Field selectById(@RequestParam("id") Integer id) {
        return fieldService.selectById(id);
    }

    /**
     * 保存属性
     */
    @PostMapping(value = "/saveField")
    public EntityResult<FieldDto> saveField(@RequestBody FieldVo vo) {
        return fieldService.saveField(vo);
    }

    /**
     * 清除数据
     */
    @PostMapping(value = "/clearFieldByFormId")
    public int clearFieldByFormId(@RequestParam("id") Integer id) {
        return fieldService.clearFieldByFormId(id);
    }
    /**
     * 分页查询
     */
    /*
    @PostMapping(value = "/selectField")
    PageResult<FieldDto> selectField(@RequestBody FieldVo fieldVo) {
        return fieldService.selectField(fieldVo);
    }
    */
}
